HomeAxis

命令軸執行"尋找原點"序列。Position 輸入用來在偵測到索引信號時設定絕對位置,若此函式在 Standstill 開始,則在 Standstill 完成。

語法

KsCommandStatus HomeAxis(
     int Index,
     double Position,
     double Velocity,
     double EndVelocity,
     double Acceleration,
     double Deceleration,
     double Jerk,
     McDirection Direction,
     McHomingMode HomingMode
);

參數

Index [in]:軸索引。索引以零為起點;別名將影響此參數。

Position [in]:在偵測到索引信號時設定絕對位置,[單位]。

Velocity [in]:原點復歸移動的開始速度。

EndVelocity [in]:原點復歸移動的結速速度,使用方式依原點復歸模式而定。

Acceleration [in]:加速度值。

Deceleration [in]:減速度值。

Jerk [in]:加加速度值。

Direction [in]:軸移動至原點的方向,使用 McDirection 類型之 0、2 或 3。

HomingMode [in]:選擇原點復歸模式,請見 McHomingMode 類型。

回傳值

返回 KsCommandStatus 結構。

備註

範例

VOID HomeLatch(INT Index) {
   //Configure the probe to use for position latching
   /*The axis will move in the preset homing direction at the high velocity
     until the probe is triggered*/
   //The axis will then move back to the latched position using the low velocity
   double PosRecord = 0;
   McProbeTrigger ProbeTrigger = { 0 };
   ProbeTrigger.TouchProbeId = 0;
   ProbeTrigger.IndexPulse = TRUE;
   ProbeTrigger.Edge = TRUE;
   KsCommandStatus probe = SetAxisTouchProbe(Index, ProbeTrigger, FALSE, 0, 0, &PosRecord);

   //Start Homing
   KsCommandStatus home = WaitForCommand(30, TRUE, HomeAxis(Index, 0, 360, 36,
	 3600, 3600, 3600000, mcPositiveDirection, homingLatch));

   double homePosition = 1;
   GetAxisPosition(Index, mcActualValue, &homePosition);
   RtPrintf("Home position: %d\n", (int)homePosition);
}

使用需求

  RT Win32
最低支援版本 4.0 4.0
標頭檔 ksmotion.h ksmotion.h
程式庫 KsApi_Rtss.lib KsApi.lib

參見

HaltAxis

StopAxis